﻿using HotelRegistrationSystem.DAL;
using HotelRegistrationSystem.Models;
using Payments.PayPal;
using System.Web.Mvc;

namespace HotelRegistrationSystem.Controllers
{
    public class PaymentController : Controller
    {
        [HttpPost]
        public ActionResult PayPalPay(PaymentModel model)
        {
            PayPalOrder order = new PayPalOrder { Amount = model.Amount };
            PayPalRedirect redirect = PayPal.ExpressCheckout(order);
            Session["token"] = redirect.Token;
            // TODO Use Paypal Ipn to do this
            //ReservationsDAL.MarkReservationAsPrepaid(model.ReservationId);
            return new RedirectResult(redirect.Url);
        }
    }
}
